Fix hang when using AbstractClassicEntityProducer#47
Closed
carterkozak wants to merge 1 commit intoapache:masterfrom
Closed
Fix hang when using AbstractClassicEntityProducer#47carterkozak wants to merge 1 commit intoapache:masterfrom
carterkozak wants to merge 1 commit intoapache:masterfrom
Conversation
When AsyncDataProducer.available returns zero, the caller may not execute the produce method again until DataStreamChannel.requestOutput has been invoked. This approach sets available to Integer.MAX_VALUE to avoid this case. It would be more efficient to call requestOutput after writes, but I'm not certain if invoking the method unnecessarily would affect performance, and the MAX_VALUE approach is used by other producers.
Member
|
@cakofony Always returning Integer.MAX_VALUE from We need to think of a better fix. How reliably can you reproduce the issue and would it be possible to make a junit? |
Member
|
@cakofony Did you have any luck reproducing the issue with an unit / integration test? |
Contributor
Author
|
Apologies, I've been busy, I will take a crack at it this week! |
c7b389f to
27ee7a1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When AsyncDataProducer.available returns zero, the caller may
not execute the produce method again until
DataStreamChannel.requestOutput has been invoked.
This approach sets available to Integer.MAX_VALUE to avoid this
case. It would be more efficient to call requestOutput after
writes, but I'm not certain if invoking the method unnecessarily
would affect performance, and the MAX_VALUE approach is used by
other producers.
I was able to reproduce this issue in a test by sending a dummy 4gb
stream using AbstractClassicEntityProducer. Overriding available with
a non-zero value stopped the hangs.
Again, it may be more efficient to track
available()invocations andcall
requestOutput()from a subtype of ContentOutputStream, but Ihaven't dug in quite that far yet :-)